import React, { Component } from 'react';
import {
    Button,
    View,
    Text,
} from 'react-native'

class HomeScreen extends Component {

    state={count:0};

    static navigationOptions={
      title:'Home页',
    };

    _increase = ()=>{
        //设置state.count+1
        let count= this.state.count;
        var preState = {
          count:count+1
        }
        this.setState(preState);
  	    console.log('count----:'+count);
    };

    getHH(){
      let count= this.state.count;
      var preState = {
        count:count+1
      }
      this.setState(preState);
	     console.log('count----:'+count);
    }

    render() {
        return (
            <View>
                <Button title='+1' onPress={() => {  this._increase(); }} />
                <Button title='HH' onPress={() => {  this.getHH(); }} />
                <Text>计数为：{this.state.count}</Text>
                <Button title='跳转到详情' onPress={()=>this.props.navigation.navigate('Detail')} />
            </View>
        )
    }

}

export default HomeScreen;
